package com.example.chesswithnet.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBConnect {

    public Connection getCount(){

        //获取数据库的连接信息
        String name = "root";
        String pass = "root";
//        String driver = "com.mysql.cj.jdbc.Driver";
        String url = "jdbc:mysql://localhost:3306/hssf0719";

        //获取数据库连接
        Connection connection = null;
        try {
            connection = DriverManager.getConnection(url,name,pass);
        } catch (SQLException e) {
            e.printStackTrace();
        }
//        if (connection != null) System.out.println("成功");
        return connection;
    }

}
